Tailwind CSS

Container


Containers are used to wrap the main content of your website or application and control its maximum width. By default, Tailwind provides a container component that sets a max-width on the content and centers it horizontally within the parent element.

 

Breakpoint

Min-width

sm640px
md768px
lg1024px
xl1280px
2xl1536px

 

Example:

<div class="container mx-auto">
 <!-- Your content here -->
</div>

 

Explanation:

  • The `container` class applies a max-width to the content.

 

Customizing Containers:

  • You can adjust the padding using specific padding classes (e.g., px-8 py-16) or modify the max-width directly in your CSS if needed.
  • Consider adding a background color (bg-gray-100) or a border (border) to visually distinguish the container from the rest of the page.